<html>
    <meta charset="utf-8"></meta>
	<script src="multiply-matrices.js"></script>
    <script src="conversions.js"></script>
    <textarea id="sRGBresults"></textarea>
    <textarea id="P3results"></textarea>
    <textarea id="a98results"></textarea>
    <textarea id="Rec2020results"></textarea>
	<script>
	// convert a sampling of
    // several RGB color spaces
    // to Lab and LCH

    console.log("test sRGB");
    sRGBresults.value += `sRGB

`;
	for (var r =0; r <=1; r+=0.5) {
        for (var g =0; g <=1; g+=0.5) {
            for (var b =0; b <=1; b+=0.5) {
                sRGBresults.value += `RGB=${r},${g},${b}
`;
                var lab = XYZ_to_Lab(D65_to_D50(lin_sRGB_to_XYZ(lin_sRGB([r, g, b]))));
                sRGBresults.value += `Lab=${lab}
`;
                sRGBresults.value += `LCH=${Lab_to_LCH(lab)}

`;
            }
        }
    };

    console.log("image-p3");
    P3results.value += `image-p3
    `;
    // I am a bad person

    for (var r =0; r <=1; r+=0.5) {
        for (var g =0; g <=1; g+=0.5) {
            for (var b =0; b <=1; b+=0.5) {
                P3results.value += `RGB=${r},${g},${b}
`;
                var lab = XYZ_to_Lab(D65_to_D50(lin_P3_to_XYZ(lin_P3([r, g, b]))));
                P3results.value += `Lab=${lab}
`;
                P3results.value += `LCH=${Lab_to_LCH(lab)}

`;
            }
        }
    };

    console.log("a98-rgb");
    a98results.value += `a98-rgb
    `;
        // seriously
    for (var r =0; r <=1; r+=0.5) {
        for (var g =0; g <=1; g+=0.5) {
            for (var b =0; b <=1; b+=0.5) {
                a98results.value += `RGB=${r},${g},${b}
`;
                var lab = XYZ_to_Lab(D65_to_D50(lin_a98rgb_to_XYZ(lin_a98rgb([r, g, b]))));
                a98results.value += `Lab=${lab}
`;
a98results.value += `LCH=${Lab_to_LCH(lab)}

`;
            }
        }
    };

    console.log("rec2020");
    Rec2020results.value += `rec2020
    `;
        // write-once paste-often
    for (var r =0; r <=1; r+=0.5) {
        for (var g =0; g <=1; g+=0.5) {
            for (var b =0; b <=1; b+=0.5) {
                Rec2020results.value += `RGB=${r},${g},${b}
`;
                var lab = XYZ_to_Lab(D65_to_D50(lin_2020_to_XYZ(lin_2020([r, g, b]))));
                Rec2020results.value += `Lab=${lab}
`;
                Rec2020results.value += `LCH=${Lab_to_LCH(lab)}

`;
            }
        }
    };


    </script>

</html>
